package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Orders;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper {

    @Insert("insert into orders values(#{id},#{number},#{status},#{userId},#{addressBookId},#{orderTime},#{checkoutTime},#{payMethod},#{amount},#{remark},#{phone},#{address},#{userName},#{consignee})")
    void save(Orders orders);


    @Select("select * from orders")
    List<Orders> findAll();

    List<Orders> findAllByEmpolee(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("number") Long number);

    @Update("UPDATE orders SET status=1 WHERE id = #{id}")
    void updateStatus(long id);

    @Select("select status from orders where id = #{id}")
    int findStatus(long id);
}
